<br />

{if $smarty.session.email} {include file="my_event/guest.tpl"} {if
$myevents}
<!-- If public user is logged, show his/her options. -->
<h2>Your events list</h2>
<br />

<table width="100%">
	<tr style="background: #ccc;">
		<th style="font-weight: bold; padding: 10px;" width="110">Picture</th>
		<th style="font-weight: bold; padding: 10px;">Video</th>
		<th style="font-weight: bold; padding: 10px;">Event name</th>
		<th style="font-weight: bold; padding: 10px;">Options</th>
	</tr>
	{foreach from=$myevents item=event}
	<tr style="background: #{cycle values='none,dedede'};"
		onmouseover="tmp=this.style.background;this.style.background='#fff';"
		onmouseout="this.style.background=tmp;">
		<td style="border-bottom: 1px dashed #ccc; padding: 10px;">{if
		$event->picture} <img src="{$event->picture|picture}" width="100"
			height="80" /> {else} No Photo {/if}</td>
		<td style="border-bottom: 1px dashed #ccc; padding: 10px;">{if
		$event->video} <a href="{$event->video}" target="_blank">Watch</a>
		{else} No Video {/if}</td>
		<td style="border-bottom: 1px dashed #ccc; padding: 10px;"><a
			href="{$REAL_ROOT}event/{$event->name|seourl}/">{$event->name}</a></td>
		<td style="border-bottom: 1px dashed #ccc; padding: 10px;"><a
			href="{$REAL_ROOT}my_event/{$event->id}/" title="Edit"><img
			src="{$WEB_ROOT}images/edit.png" alt="Edit" /></a> <a
			href="{$REAL_ROOT}my_event/delete/{$event->id}/" class="delete"
			rel="event" title="Delete"><img src="{$WEB_ROOT}images/delete.png"
			alt="Delete" /></a></td>
	</tr>
	{/foreach}
</table>
{/if} {if $myevent}
<!-- if public user select a specific event. Show update form. -->
<h2>{$myevent->name}</h2>
<br />

{if $errors}
<!-- display errors here if any -->
<fieldset
	style="color: #f00; font-weight: bold; border: 1px solid #f00; padding: 10px;">
<legend style="padding: 0 10px 0 10px;">Error</legend> {foreach
from=$errors item=error} &bull {$error} <br />
{/foreach}</fieldset>
<br />
{/if}

<small>Fields marked with asterisks(<span style="color: #f00;">*</span>)
are required.</small>
<br />
<br />

<form method="post" action="{$REAL_ROOT}my_event/update/{$myevent->id}/"
	enctype="multipart/form-data"><input type="hidden" name="id"
	value="{$myevent->id}" />

<table>
	<tr>
		<td width="100"><span style="color: #f00;">*</span>Event name:</td>
		<td style="padding: 5px;"><input type="text" name="name"
			value="{$myevent->name}" style="width: 320px;" /></td>
		<td style="color: #777;">The name of this event.</td>
	</tr>
	<tr>
		<td>Description:</td>
		<td style="padding: 5px;"><textarea name="description" rows="5"
			cols="10" style="width: 320px;">{php}echo stripslashes($this->_tpl_vars['myevent']->description);{/php}</textarea></td>
		<td style="color: #777;">Description of this event.</td>
	</tr>
	<tr>
		<td>Photo:</td>
		<td style="padding: 5px;">{if $myevent->picture} <input type="hidden"
			name="picture" value="{$myevent->picture}" /> <img
			src="{$myevent->picture|picture}" width="100" height="80" /> <br />
		{/if} <input type="file" name="picture" size="37" /></td>
		<td style="color: #777;">Upload photo for this event.</td>
	</tr>
	<tr>
		<td>Video:</td>
		<td style="padding: 5px;"><input type="text" name="video"
			style="width: 320px;" /></td>
		<td style="color: #777;">Enter video URL for this event.</td>
	</tr>
	<tr>
		<td><span style="color: #f00;">*</span>Categories:</td>
		<td style="padding: 5px;"><select name="sports[]" size="4"
			multiple="multiple" style="width: 320px;">
			{html_options values=$pk_sport_ids output=$pk_sport_vals
			selected=$myevent->sports}
		</select></td>
		<td style="color: #777;">Select categories that fit this event or
		enter new category if not available.</td>
	</tr>
	<tr>
		<td colspan="3"><br />
		<h3>Contact Details</h3>
		</td>
	</tr>
	<tr>
		<td>Host:</td>
		<td style="padding: 5px;"><input type="text" name="host"
			value="{$myevent->details->host}" style="width: 320px;" /></td>
		<td style="color: #777;">Who hosts this event.</td>
	</tr>
	<tr>
		<td>Contact:</td>
		<td style="padding: 5px;"><input type="text" name="contact"
			value="{$myevent->details->contact}" style="width: 320px;" /></td>
		<td style="color: #777;">Contact Person.</td>
	</tr>
	<tr>
		<td>Email:</td>
		<td style="padding: 5px;"><input type="text" name="contact_email"
			value="{$myevent->details->contact_email}" style="width: 320px;" /></td>
		<td style="color: #777;">Contact Email.</td>
	</tr>
	<tr>
		<td>Location:</td>
		<td style="padding: 5px;"><input type="text" name="location"
			value="{$myevent->details->location}" style="width: 320px;" /></td>
		<td style="color: #777;">Location for this event.</td>
	</tr>
	<tr>
		<td>City:</td>
		<td style="padding: 5px;"><input type="text" name="city"
			value="{$myevent->details->city}" style="width: 320px;" /></td>
		<td style="color: #777;">City</td>
	</tr>
	<tr>
		<td>State:</td>
		<td style="padding: 5px;"><input type="text" name="state"
			value="{$myevent->details->state}" style="width: 320px;" /></td>
		<td style="color: #777;">State</td>
	</tr>
	<tr>
		<td>Country:</td>
		<td style="padding: 5px;"><input type="text" name="country"
			value="{$myevent->details->country}" style="width: 320px;" /></td>
		<td style="color: #777;">Country</td>
	</tr>
	<tr>
		<td>Website:</td>
		<td style="padding: 5px;"><input type="text" name="website"
			value="{$myevent->details->website|default:'http://'}"
			style="width: 320px;" /></td>
		<td style="color: #777;">Website for this event.</td>
	</tr>
	<tr>
		<td colspan="3"><br />
		<h3>Ranking Criteria</h3>
		</td>
	</tr>
	<tr>
		<td>Distance:</td>
		<td style="padding: 5px;"><input type="text" name="distance"
			value="{$myevent->details->distance}" style="width: 320px;" /></td>
		<td style="color: #777;">Length of the event in miles from start to
		finish.</td>
	</tr>
	<tr>
		<td>Time to complete:</td>
		<td style="padding: 5px;"><input type="text" name="time_to_complete"
			value="{$myevent->details->time_to_complete}" style="width: 320px;" /></td>
		<td style="color: #777;">Length in hours of the event from start to
		finish.</td>
	</tr>
	<tr>
		<td>Terrain:</td>
		<td style="padding: 5px;"><input type="text" name="terrain"
			value="{$myevent->details->terrain}" style="width: 320px;" /></td>
		<td style="color: #777;">Terrain has elevation</td>
	</tr>
	<tr>
		<td>Climate:</td>
		<td style="padding: 5px;"><input type="text" name="climate"
			value="{$myevent->details->climate}" style="width: 320px;" /></td>
		<td style="color: #777;">Local temperature, humidity, wind, etc.</td>
	</tr>
	<tr>
		<td>Factor:</td>
		<td style="padding: 5px;"><input type="text" name="factor"
			value="{$myevent->details->factor}" style="width: 320px;" /></td>
		<td style="color: #777;">Factor is used to equalize sports.</td>
	</tr>
	<tr>
		<td>Support:</td>
		<td style="padding: 5px;"><input type="text" name="support"
			value="{$myevent->details->support}" style="width: 320px;" /></td>
		<td style="color: #777;">The amount of support for the event by
		volunteers and crew.</td>
	</tr>
	<tr>
		<td></td>
		<td style="padding: 5px;"><br />
		<input type="submit" value="Update Event" /></td>
	</tr>
</table>
</form>
{/if} {/if} {if $public}
<!-- Show options to public whether to login or to submit event. -->
<h2>Already submitted your event(s)?</h2>
<br />

{if $errors1}
<!-- display errors here if any -->
<fieldset
	style="color: #f00; font-weight: bold; border: 1px solid #f00; padding: 10px;">
<legend style="padding: 0 10px 0 10px;">Error</legend> {foreach
from=$errors1 item=error} &bull; {$error} <br />
{/foreach}</fieldset>
<br />
{/if}
<form action="" method="post"><input type="hidden" name="find" value="1" />
Enter your email: <input type="text" name="email" size="30" /> <input
	type="submit" value="Show my events" /></form>
<br />

<h2>--- OR ---</h2>

<br />

{include file="my_event/submit.tpl"} {/if}
